<div class="jobs index">
	<h2><?php echo __('Jobs');?></h2>
	<table cellpadding="0" cellspacing="0">
	<tr>
			<th><?php echo $this->Paginator->sort('id');?></th>
			<th><?php echo $this->Paginator->sort('domain_id');?></th>
			<th><?php echo $this->Paginator->sort('user_id');?></th>
			<th><?php echo $this->Paginator->sort('status');?></th>
			<th><?php echo $this->Paginator->sort('description');?></th>
			<th class="actions">&nbsp;</th>
	</tr>
	<tr class="filtr">
	<?php echo $this->Form->create('Job',array('url'=>array('controller'=>'jobs', 'action'=>'index'),'name'=>'_display_jobs_'));?>
			<th><?php echo __('Filtr:',true)?></th>
			<th><?php echo $this->Form->input('domain_id',array('options'=>$domains,'label'=>false,'div'=>false,'empty'=>'','onchange'=>'document._display_jobs_.submit(); event.returnValue = false; return false;'))?></th>
			<th><?php echo $this->Form->input('user_id',array('options'=>$users,'label'=>false,'div'=>false,'empty'=>'','onchange'=>'document._display_jobs_.submit(); event.returnValue = false; return false;'))?></th>
			<th><?php echo $this->Form->input('status',array('options'=>array('0'=>__('Not Done',true),'1'=>__('Done',true)),'label'=>false,'div'=>false,'empty'=>'','onchange'=>'document._display_jobs_.submit(); event.returnValue = false; return false;'))?></th>
			<th>&nbsp;</th>
			<th class="actions">
				<?php echo $this->Html->link(__('Cancel'), array('controller'=>'articles','action' => 'index')); ?>
			</th>
			<?php echo $this->Form->end();?>
		</tr>
			
	<?php
	foreach ($jobs as $job): ?>
	<tr <?php if(isset($job['Domain']) && count($job['Domain']) == 1 ){?> onclick="document.location='<?php echo $this->Html->url(array('controller'=>'domains','action' => 'view', $job['Domain'][0]['id'],'d'=>'jobs'),true);?>'"<?php }?>>
		<td><?php echo h($job['Job']['id']); ?>&nbsp;</td>
		<td><?php if(isset($job['Domain']) && count($job['Domain']) != 0 ){ $i=0; foreach ($job['Domain'] as $project) { echo (($i != 0)?'<br/>':'').$this->Html->link($project['name'], array('controller'=>'domains','action' => 'view',$project['id'],'d'=>'jobs')); $i++; } } ?>&nbsp;</td>
		<td><?php if(isset($job['User']) && count($job['User']) != 0 ){ $i=0; foreach ($job['User'] as $project) { echo (($i != 0)?'<br/>':'').$project['username']; $i++; } } ?>&nbsp;</td>
		<td><?php echo h($job['Job']['status']); ?>&nbsp;</td>
		<td><?php echo h($job['Job']['description']); ?>&nbsp;</td>
		<td class="actions">
&nbsp;
		</td>
	</tr>
<?php endforeach; ?>
	</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
	));
	?>	</p>

	<div class="paging">
	<?php
		echo $this->Paginator->prev('< ' . __('previous'), array(), null, array('class' => 'prev disabled'));
		echo $this->Paginator->numbers(array('separator' => ''));
		echo $this->Paginator->next(__('next') . ' >', array(), null, array('class' => 'next disabled'));
	?>
	</div>
</div>

<div class="actions">
	<?php echo $this->element('/menu/main')?>
	<?php echo $this->element('/menu/settings')?>
</div>

